home *** CD-ROM | disk | FTP | other *** search
/ GRAVIS Top 100 #1 / GRAVIS CD No1_Herbst_94.cdr / GRAVIS / Updates / Gravis Joystick Treiber neu / MouseStick⁄GamePad Sample Code < prev   
Text File  |  1993-09-03  |  3KB  |  76 lines

  1. © Copyright 1993, Advanced Gravis Computer Technology Ltd.
  2.  
  3. This sample code has been provided to assist Macintosh software developers in supporting the Gravis MouseStick®, Gravis Mac GamePad™ and other Gravis products in their programs.
  4.  
  5. All or portions of this code may be used without royalty or license fees for supporting products manufactured or licensed by Advanced Gravis Computer Technology Ltd. This code may not be copied, distributed or used for supporting hardware products not manufactured or licensed by Advanced Gravis without specific written autorization of Advanced Gravis.
  6.  
  7. Using the following code, programmers can find the MouseStick driver, get information about it and read the information coming from the MouseStick. This will work for any earlier versions of the 3 button MouseStick* or the MouseStick II using the MouseStick II control panel software version 3.2 or later.
  8.  
  9. * Earlier version of the MouseStick must be equipped with the latest ROM version (3.3).
  10.  
  11. Δ    Items labelled private are reserved.
  12.  
  13. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  14.  
  15.     
  16. typedef struct
  17.     {
  18.     long        signature;                /* our signature */
  19.     char        private1[18];
  20.     short        numSticksConnected;        /* how many gamepads are available */
  21.     char        private2[22];
  22.     
  23.             /* STICK 1 INFO */
  24.     short        stick1_xIn;                /* absolute stick position */
  25.     short        stick1_yIn;                /* absolute stick position */
  26.     Byte        stick1_buttons;            /* button states */
  27.     Byte        private3;
  28.     short        stick1_xOut;            /* adjusted cursor position */
  29.     short        stick1_yOut;            /* adjusted cursor position */
  30.     char        stick1_old                /* true if device is an old mousestick */
  31.     char        private4;
  32.     char        stick1_on;                /* pad is on or off */
  33.     char        private5;    
  34.     char        stick1_cursorCouple;    /* true if stick should move cursor */
  35.     char        stick1_appAware;        /* is driver switching sets? */
  36.     char        private6[152];
  37.     
  38.             /* STICK 2 INFO */
  39.     short        stick2_xIn;                /* absolute stick position */
  40.     short        stick2_yIn;                /* absolute stick position */
  41.     Byte        stick2_buttons;            /* button states */
  42.     Byte        private7;
  43.     short        stick2_xOut;            /* adjusted cursor position */
  44.     short        stick2_yOut;            /* adjusted cursor position */
  45.     char        stick2_old                /* true if device is an old mousestick */
  46.     char        private8;
  47.     char        stick2_on;                /* pad is on or off */
  48.     char        private9;    
  49.     char        stick2_cursorCouple;    /* true if stick should move cursor */
  50.     char        stick2_appAware;        /* is driver switching sets? */
  51.     char        private6[152];
  52.     
  53.     } *driverVarsPtr;
  54.  
  55.  
  56.  
  57. /* _________________________________________________________ */
  58. driverVarsPtr    getMouseStickDriverVars()
  59.     {
  60.     ADBDataBlock    adbGetInfo;
  61.     driverVarsPtr    vars;
  62.     short            x, numADB;
  63.     char            found = false;
  64.     
  65.     numADB = CountADBs();
  66.     for (x = 1; x <= numADB; x++)
  67.         {
  68.         GetADBInfo(&adbGetInfo,GetIndADB(&adbGetInfo,x));
  69.         vars = (driverVarsPtr)adbGetInfo.dbDataAreaAddr;
  70.         if (vars != nil && vars->signature == 0x4A656666)
  71.             return(vars);
  72.         }
  73.     return (nil);
  74.     }
  75.  
  76.